<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
		/* 定义动画bear，使熊逐帧动起来 */
		@keyframes bear {
		    0% {
		        background-position: 0 0;
		    }
		    100% {
		        background-position: -1600px 0;
		    }
		}
		/* 定义动画move 使熊移动至水平垂直居中位置 */
		@keyframes move {
		    0% {
		        left: 0;
		    }
		    100% {
		        left: 50%;
		        /* margin-left: -100px; */
		        transform: translateX(-50%);
		    }
		}
		@keyframes bgmove{
			0% {
			    background-position: 0 0;
			}
			100% {
				/* 背景偏移至2/3 */
			    background-position: -2560px 0;
			}
		}
		
		
        body {
			animation: bgmove 8s linear infinite;
			background: url(img/bg.png) no-repeat;
        }
		
        /* 熊 */
        div {
            position: absolute;
            width: 200px;
            height: 100px;
			top: 200px;
            background: url(img/bear.png) no-repeat;
            /* 添加动画bear 时长0.4s 间隔数量(步长)8 循环；
			添加动画move 时长3秒 结束时保持结束状态 */
            animation: bear .4s steps(8) infinite, move 3s forwards;
        }
           
    </style>
</head>

<body>
    <div></div>
</body>

</html>